<?php
require 'Curl.php';
require 'Diggme.php';

$appKey = 'xxxxxx'; //appKey
$appSecret = 'xxxxxxxxxxxxxxxx'; //appSecret
$diggme = new Diggme($appKey, $appSecret);

/**
 * 获取token
 */
$response = $diggme->getToken();

/**
 * 获取分类
 */
$response = $diggme->getCategoryList();

/**
 * 获取测试列表
 */
$response = $diggme->getTestList(0, 1, 10);

/**
 * 获取测试详情
 */
$testId = 10; //测试ID，以10举列
$response = $diggme->getTestDetail($testId);

/**
 * 获取测试订单兑换码(in_code)
 * 得到的code是固定的，可保存到数据库
 */
$orderNo = 'N001'; //你们的订单号
$response = $diggme->getTestCode($testId, $orderNo);

/**
 * 获取测试兑换码(in_code)状态
 */
$inCode = 'xxxxxxxxxxxxxxx-xxxxxx'; //来自于上面$diggme->getTestCode()
$response = $diggme->getCodeStatus($testId, $inCode);

/**
 * 订单状态回调
 */
$response = $diggme->postNotifyPay($inCode);


